home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_056 / mcad / tdp / tdp.doc < prev    next >
Text File  |  1992-05-06  |  5KB  |  99 lines

  1. **************************************************************************
  2.  
  3.     THIS SOFTWARE IS IN THE PUBLIC DOMAIN.  IT IS INTENDED TO
  4.     BE AVAILABLE FREE TO WHOMEVER WANTS IT.  YOU MAY USE AND
  5.     DISTRIBUTE IT AS YOU LIKE WITH THE FOLLOWING RESTRICTIONS:
  6.  
  7.     1)  You may not sell this software or charge more than a
  8.         small copying/hassle fee for distributing it.
  9.  
  10.     2)  Don't remove this notice from the distribution.
  11.  
  12.         Tim Mooney
  13.         120 Purefoy Rd.
  14.         Chapel Hill, NC 27514
  15.     also:
  16.         Physics Dept.
  17.         Phillips Hall
  18.         University of NC
  19.         Chapel Hill, NC 27514
  20.  
  21. ****************************************************************************
  22.  
  23.     tdp.c -  3-D DATA VIEWING ROUTINE
  24.    
  25.       Tdp displays the projection on the x-y plane of a function z(x,y).
  26.    The function must be single-valued, and defined on a regular x-y grid.
  27.  
  28. ------------------------------------------------------------------------
  29.  
  30.       To get a quick idea of what is going on here, drop a net over a
  31.    chessboard in the middle of a game: the heights of the various pieces
  32.    are the z coordinates; the positions (row, column) of the pieces are
  33.    the (x, y) coordinates.  Tdp draws a picture of the net.
  34.    
  35.       Continuing with the chessboard analogy: tdp first wants to know how
  36.    many rows and columns of data to expect.  Then it wants z coordinates,
  37.    starting with the row nearest you, from left to right, to the row
  38.    nearest your opponent.  Further, tdp wants all of this in a binary
  39.    file: 4-byte-int (# rows); 4-byte-int (# columns); 4-byte-floats (z
  40.    coordinates).  Tdp does NOT want x or y coordinates in the data file. 
  41.    (The program t2f exists to convert a text file of z-data to a binary
  42.    file tdp will plot.  The user supplies the number of rows and columns
  43.    on the command line.)
  44.    
  45.       You tell tdp from what viewing point you wants to see the net.
  46.    Imagine looking at the board "edge-on" -- your eyes level with the
  47.    table -- and facing your opponent.  Tdp calls this position
  48.    "phi = 0 degrees, theta = 0 degrees".  If you rotate the board clock-
  49.    wise (as seen from above) on the table, you are increasing phi to some
  50.    positive value.  Now with phi fixed, tilt the table toward you so that
  51.    the pieces would fall in your lap.  To tdp, this decreases theta to
  52.    some negative angle;  it gives you a view of the top of the board.
  53.    (You math folks will have recognized that phi and theta are Euler
  54.    angles.)  The viewing distance is hardwired in (variable "dist" in
  55.    the function calc().)
  56.  
  57.       Tdp uses a very simple algorithm for hidden-line removal: lines are
  58.    plotted from the bottom of the screen up; for each possible horizontal
  59.    position, a record is kept of the topmost point plotted so far.  This
  60.    algorithm is suitable for binned data, chessboards viewed from above,
  61.    and the like.  A command line option ("-b") allows a "bottom view " of
  62.    the data set to be displayed also;  the same algorithm is used in reverse.
  63.    
  64.      BUGS: Occasionally, tdp will draw a stray line when phi is set to 0
  65.    or a multiple of 90 degrees.  I haven't found the offending piece of
  66.    code yet.  Since translation to Lattice 3.1, axes are weird, don't use.
  67.  
  68. **************************************************************************
  69.  
  70.       Tdp is loosely based on a program originally written in FORTRAN on
  71.    the VAX at Triangle Universities Nuclear Laboratory.  The program used
  72.    low level GRZ (TM of Bell Labs) calls to plot on a Tektronix graphics
  73.    terminal.  Since the only AMIGA graphics routines really required are
  74.    Move(), and Draw(), it should be fairly easy to port this program around.
  75.       One more thing: in several places, tdp assumes that ints and floats
  76.    are the same size.  This saves time and memory for the executable, but
  77.    it's still an unfriendly thing to do.  Sorry about that.
  78.  
  79. *************************************************************************
  80. MENUS:
  81.       There is one menu with the following choices:
  82.  
  83. Open           not implemented
  84.  
  85. Mk Plot File   While generating the NEXT plot, tdp will write a file
  86.                which can be sent ("Copy myplotfile TO ser:") to any plotter
  87.                that understands HPGL, the Hewlett Packard Graphics Language.
  88.                Commands in the plot file instruct the (serial interface)
  89.                plotter to use xON/xOFF.
  90.  
  91. Mk mCAD File   While generating the NEXT plot, tdp will write a file
  92.                compatible with "mCAD", a shareware object-oriented drawing
  93.                program.
  94.  
  95. Quit           Closes hi-res screen and returns you to the command line.
  96.                The program asks if you want to continue this plot -- e.g.,
  97.                to select another set of viewing angles.  If you don't,
  98.                tdp exits.
  99.